// pages/evaluateHistoryDetail/index.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    doctorReplyData:[],
    submit:{
    },
    questionId:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    if (options.questionId){
      this.getDataDetail(options.questionId, () => {

      })
      this.data.questionId = options.questionId
    }
    
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },
  onPullDownRefresh: function () {
    this.getDataDetail(this.data.questionId,() => {
      wx.stopPullDownRefresh()
    })
  },
  getDataDetail(id,callBack){
    var that = this
    app.post(app.Apis.GET_QUESTION_DETAIL,{
      questionId:id
    },result=>{
      console.log(result)
      let n = result.data.question
      n.imgUrls = JSON.parse(n.imgUrls)
      that.setData({
        submit: n,
        doctorReplyData: result.data.dialogList
      })
      callBack()
    })
  }
})